<template>
  <j-modal-no-footer
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    :noFooter="true"
    cancelText="关闭">
    <a-card :bordered="false">
      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="物料条码">
                <j-input placeholder="请输入物料条码" v-model="queryParam.materialBarCode"></j-input>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
              <a-form-item label="物料状态">
                <j-dict-select-tag placeholder="请选择物料状态" v-model="queryParam.materialStatus" dictCode="material_status"/>
              </a-form-item>
            </a-col>
            <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <!-- 查询区域-END -->

      <!-- table区域-begin -->
      <div>
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          class="j-table-force-nowrap"
          @change="handleTableChange">
        </a-table>
      </div>
      <!-- table区域-end -->

    </a-card>
  </j-modal-no-footer>

</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  import {getAction} from '@/api/manage'


  export default {
    name: 'MesMaterialDetailsList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
    },
    data () {
      return {
        title:'物料明细',
        width:800,
        visible: false,
        disableSubmit: false,


        queryParam:{},
        description: '物料明细表管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'物料条码',
            align:"center",
            dataIndex: 'materialBarCode'
          },
          {
            title:'物料状态',
            align:"center",
            dataIndex: 'materialStatus_dictText'
          },
          // {
          //   title: '操作',
          //   dataIndex: 'action',
          //   align:"center",
          //   fixed:"right",
          //   width:147,
          //   scopedSlots: { customRender: 'action' }
          // }
        ],
        url: {
          list: "/mes/mesMaterialDetails/list"
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      show(mainId){
        this.visible=true;
        console.log('mainId',mainId);
        this.ipagination.current = 1;
        this.queryParam.mainId=mainId;
        this.loadData(1);
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'materialBarCode',text:'物料条码',dictCode:''})
        fieldList.push({type:'string',value:'materialStatus',text:'物料状态',dictCode:'material_status'})
        this.superFieldList = fieldList
      },
      loadData(arg) {
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        const params = this.getQueryParams();//查询条件
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records;
            this.ipagination.total = res.result.total;
          }
        })
      },
      //弹窗相关时间
      handleCancel() {
        this.visible = false;
      },
      handleOk() {
        debugger
        this.visible = false;
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>